package edu.tongji.structureplayer.structure
{
    public class Element extends BaseStructure
    {
        private var _startNode:Node;
        private var _endNode:Node;
        private var _property:Property;
        private var _startConnection:Connection;
        private var _endConnection:Connection;
        
        public function Element(name:String, startNode:Node, endNode:Node, property:Property, 
                                startConnection:Connection, endConnection:Connection)
        {
            super(name);
            _startNode = startNode;
            _endNode = endNode;
            _property = property;
            _startConnection = startConnection;
            _endConnection = endConnection;
        }
        
        public function overlap(startNode:Node, endNode:Node, property:Property, 
                                startConnection:Connection, endConnection:Connection):Boolean
        {
            if (startNode!=_startNode || endNode!=_endNode || property!=_property
            || startConnection!=_startConnection || endConnection!=_endConnection)
                return false;
            return true;
        }

        public function get startNode():Node
        {
            return _startNode;
        }

        public function set startNode(value:Node):void
        {
            _startNode = value;
        }

        public function get endNode():Node
        {
            return _endNode;
        }

        public function set endNode(value:Node):void
        {
            _endNode = value;
        }

        public function get property():Property
        {
            return _property;
        }

        public function set property(value:Property):void
        {
            _property = value;
        }

        public function get startConnection():Connection
        {
            return _startConnection;
        }

        public function set startConnection(value:Connection):void
        {
            _startConnection = value;
        }

        public function get endConnection():Connection
        {
            return _endConnection;
        }

        public function set endConnection(value:Connection):void
        {
            _endConnection = value;
        }
        
        public function debugPrint():void
        {
            trace("Element " + name + "(" 
                + (_startNode==null?null:_startNode.name) + ", " 
                + (_endNode==null?null:_endNode.name) + ", " 
                + (_property==null?null:_property.name) + ", "
                + (_startConnection==null?null:_startConnection.name) + ", " 
                + (_endConnection==null?null:_endConnection.name) + ")");
        }

    }
}